/**
 * Created by Administrator on 2017/5/25.
 */
"use strict";
//引入模块
const mongoose = require('mongoose');
const db = require('./db');

// Schema 结构
var AriafansSchema = new mongoose.Schema({
    afid      :{type:Number,index: true},//afid
    bid     :{type:Number,index: true},//书id
    uid     :{type:Number,index: true},//用户id
    reward    :{type : Number}//总打赏
});

AriafansSchema.statics.findFn = function(obj,obj1, callback) {
    return this.model('Ariafans').find(obj, callback).sort(obj1);
};
AriafansSchema.statics.findFnLimit = function(obj,obj1,num1,callback) {
    return this.model('Ariafans').find(obj).sort(obj1).limit(num1).exec(callback);
};
AriafansSchema.statics.findSortOne = function(obj,obj1,callback) {
    return this.model('Ariafans').findOne(obj).sort(obj1).exec(callback);
};
AriafansSchema.statics.findConut = function(obj,callback) {
    return this.model('Ariafans').find(obj).count().exec(callback);
};
AriafansSchema.statics.updateFn = function(obj,obj1,callback) {
    return this.model('Ariafans').update(obj,obj1).exec(callback);
};

var AriafansModel = db.model('Ariafans', AriafansSchema);

module.exports=AriafansModel;